//
//  MenuViewController.m
//  iTeVe
//
//  Created by Pedro Gonzalez on 27/01/14.
//  Copyright (c) 2014 SISI Software. All rights reserved.
//

#import "MenuViewController.h"
//#import "ClientiViewController.h"

@interface MenuViewController ()


@end

@implementation MenuViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    lingua = NSLocalizedString(@"_LINGUA", @"2 caratteri lingua");
    
    if ([lingua  isEqual: @"EN"]){
        items = [[NSMutableArray alloc] initWithObjects:@"Sales", @"Stock loading", @"Stock unloading", @"Payments", @"Customers", @"Products", @"Configuration", @"Syncronize", nil];
    } else if ([lingua  isEqual: @"ES"]){
        items = [[NSMutableArray alloc] initWithObjects:@"Ventas", @"Aumento de stock", @"Descarga de Stock", @"Pagos", @"Clientes", @"Productos", @"Configuración", @"Sincronizar", nil];
    } else {
        items = [[NSMutableArray alloc] initWithObjects:@"Ordini", @"Carico", @"Scarico", @"Pagamenti", @"Clienti", @"Articoli", @"Configurazione", @"Sincronizzare", nil];
    }
   

 }




- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [items count];
//    return 6;
}





- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
    }
    
    // Configure the cell...

    /*
    long riga = (long)[indexPath row]+1;
    if (riga==1){
        cell.imageView.image = [UIImage imageNamed:@"Mail-icon.png"];
    } else if (riga==2) {
        cell.imageView.image = [UIImage imageNamed:@"Phone-icon.png"];
    }
     */

   cell.textLabel.text = [items objectAtIndex:indexPath.row];
    
    
    return cell;
}



// In a story board-based application, you will often want to do a little preparation before navigation

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.

    /*
    if([[segue identifier] isEqualToString:@"segueClienti"])    {
        //ClientiViewController *mvc = [segue destinationViewController];
        [segue destinationViewController];
    } else if([[segue identifier] isEqualToString:@"segueArticoli"])    {
        [segue destinationViewController];
    }
    */
    
   [segue destinationViewController];
    
}




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    long riga = (long)[indexPath row]+1;
    if (riga==1){
        [self performSegueWithIdentifier:@"segueOrdini" sender:self.view];
    } else if (riga==2){
    } else if (riga==3){
    } else if (riga==4){
    } else if (riga==5){
        [self performSegueWithIdentifier:@"segueClienti" sender:self.view];
    } else if (riga==6){
        [self performSegueWithIdentifier:@"segueArticoli" sender:self.view];
    } else if (riga==7){
        [self performSegueWithIdentifier:@"segueConfigurazione" sender:self.view];
    } else if (riga==8){
        [self performSegueWithIdentifier:@"segueSync" sender:self.view];
    }
    

    
}



@end
